# Contributor: Stefan de Konink <stefan@konink.de>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
#
# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=qt6
pkgname=qt6-qtmqtt
pkgver=6.7.2
pkgrel=0
pkgdesc="Qt module that Provides MQTT communication"
url="https://qt.io/"
arch="all"
license="LGPL-2.1-only AND LGPL-3.0-only AND GPL-3.0-only AND Qt-GPL-exception-1.0"
depends_dev="
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	"
makedepends="$depends_dev
	cmake
	perl
	samurai
	"
checkdepends="qt6-qtwebsockets-dev"
subpackages="$pkgname-dev"
builddir="$srcdir/qtmqtt-${pkgver/_/-}"
# the test suite of this package requires a running MQTT-server
options="!check"

case $pkgver in
	*_alpha*|*_beta*|*_rc*) _rel=development_releases;;
	*) _rel=official_releases;;
esac

source="$pkgname-$pkgver.tar.gz::https://github.com/qt/qtmqtt/archive/refs/tags/v${pkgver/_/-}.tar.gz"

replaces="qt6-mqtt"

build() {
	export CFLAGS="$CFLAGS -flto=auto"
	export CXXFLAGS="$CXXFLAGS -flto=auto"
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
02c5c30471ca7031facf978c05b00e6a300e90eeeb958389489f3e90a076bb4bf976aa2835af0443711d3c48e6abd4e1ef39d351e8c04e44d83a860867e63309  qt6-qtmqtt-6.7.2.tar.gz
"
